﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ClassSystem
{
    public partial class ASPTeacherLogin : System.Web.UI.Page
    {
        DBHelperF db = new DBHelperF();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Label1.Text = DateTime.Now.ToString();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string sql = string.Format("select * from [dbo].[TeacherSInfoS] where TeacherID='{0}' and TeacherPwd='{1}'",
                this.txtname.Text.Trim(),
                this.txtpwd.Text.Trim());
            if (this.txtname.Text == "" || this.txtpwd.Text == "")
            {
                Response.Write("账号和密码不能为空！");
            }
            else
            {
                if (db.GetData(sql).Tables[0].Rows.Count > 0)
                {
                    Response.Redirect("ASPIndexTeacher.aspx");
                }
                else
                {
                    Response.Write("<script>alert('登录失败!')</script>");
                }
            }
        }
    }
}